#pragma once

#include <iostream>
#include <GL\glui.h>
#include "includes.h"

class Component
{
private:
	string ID;
	vector<Transformation*> transforms;
	vector<Primitive*> primitives;
	vector<Material*> mats;
	vector<Material*> matsColour;
	vector<string> primitivesString;
	vector<string> childrenString;
	bool materialInherited;
	bool textureInherited;
	bool noTexture;
	bool materialColoured;
	int currentMaterial;
	char key;
	Texture* tex;
	vector<Component*> children;

public:
	Component() 
	{
		setMaterialInherit(false);
		setTextureInherit(false);
		setNoTexture(false);
		currentMaterial = 0;
		key = '\0';
	}

	void setCurrent(int c)
	{
		currentMaterial = c;
	}

	int getCurrent()
	{
		return currentMaterial;
	}

	void setID(string _ID)
	{
		ID= _ID;
	}

	string getID()
	{
		return ID;
	}

	vector<Transformation*> getTransforms()
	{
		return transforms;
	}

	vector<Component*> getChildren()
	{
		return children;
	}

	vector<Primitive*> getPrimitives()
	{
		return primitives;
	}

	vector<Material*> getMaterials()
	{
		return mats;
	}

	vector<Material*> getMaterialsColour()
	{
		return matsColour;
	}

	vector<string> getPrimitivesString()
	{
		return primitivesString;
	}

	vector<string> getChildrenString()
	{
		return childrenString;
	}

	Texture* getTexture()
	{
		return tex;
	}

	char getKey()
	{
		return key;
	}

	bool getMaterialInherit()
	{
		return materialInherited;
	}

	bool getMaterialCol()
	{
		return materialColoured;
	}

	bool getTextureInherit()
	{
		return textureInherited;
	}

	bool getNoTexture()
	{
		return noTexture;
	}

	void setTransforms(vector<Transformation*> t)
	{
		transforms = t;
	}

	void setPrimitives(vector<Primitive*> p)
	{
		primitives = p;
	}

	void setMaterials(vector<Material*> m)
	{
		mats = m;
	}

	void setMaterialsColour(vector<Material*> m)
	{
		matsColour = m;
	}

	void setPrimitivesString(vector<string> p)
	{
		primitivesString = p;
	}

	void setChildrenString(vector<string> c)
	{
		childrenString = c;
	}
	void setTexture(Texture* t)
	{
		tex = t;
	}

	void setChildren(vector<Component*> c)
	{
		children = c;
	}

	void setMaterialInherit(bool b)
	{
		materialInherited = b;
	}

	void setMaterialCol(bool b)
	{
		materialColoured = b;
	}

	void setTextureInherit(bool b)
	{
		textureInherited = b;
	}
	
	void setNoTexture(bool b)
	{
		noTexture = b;
	}

	void setKey(char k)
	{
		key = k;
	}

	void attributeElements(map<string, Primitive*> primitivesMap, map<string, Component*> componentsMap);
	void constructTree(map<string, Primitive*> primitivesMap, map<string, Component*> componentsMap);
	void runComponent(Texture* t, vector<Material*> m, bool change, char k);
	void applyTransforms();
	void applyMaterials();
	void renderPrimitives(Texture* t);
	void applyMaterialsColour(bool change, char k);
	vector<char> getKeys();
};